package cn.walls1717.ggkt.vod.controller;

import cn.walls1717.ggkt.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 用户相关接口
 *
 * TODO 模拟登录，未真正实现
 *
 * @author walls1717
 * @since 2022/7/13
 **/
@Api(tags = "用户相关接口")
@RestController
@RequestMapping("/admin/vod/user")
public class UserLoginController {

    @ApiOperation("登录")
    @PostMapping("login")
    public Result<Map<String, Object>> login() {
        // {"code":20000,"data":{"token":"admin-token"}}
        HashMap<String, Object> map = new HashMap<>(1);
        map.put("token", "admin-token");
        return Result.success(map);
    }

    @ApiOperation("获取登录信息")
    @GetMapping("info")
    public Result<Map<String, Object>> getInfo() {
        // {"code":20000,
        // "data":{
        // "roles":["admin"],
        // "introduction":"I am a super administrator",
        // "avatar":"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
        // "name":"Super Admin"}}
        HashMap<String, Object> map = new HashMap<>(4);
        map.put("roles", "[admin]");
        map.put("introduction", "I am a super administrator");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        map.put("name", "Super Admin");
        return Result.success(map);
    }
}
